﻿using TCommunication.Model.Enum;

namespace TCommunication.Model;
/// <summary>
/// Can帧
/// </summary>
public class CanFrame
{
    /// <summary>
    /// CanId,29位byte
    /// </summary>
    public uint CanId { get; set; }

    /// <summary>
    /// 是否是拓展帧,默认true
    /// </summary>
    public bool IsEff { get; set; } = true;

    /// <summary>
    /// 是否是远程帧,默认false
    /// </summary>
    public bool IsRtr { get; set; } = false;

    /// <summary>
    /// 是否是错误帧,默认false
    /// </summary>
    public bool IsErr { get; set; } = false;

    /// <summary>
    /// 是否是CanFd
    /// </summary>
    public bool IsCanFd { get; set; } = false;

    /// <summary>
    /// 使用CanFd时的额外标识，比如CanFd加速
    /// </summary>
    public byte CanFdFlags { get; set; }

    /// <summary>
    /// 数据长度
    /// </summary>
    public byte CanLenth { get; set; }

    /// <summary>
    /// 对齐，忽略
    /// </summary>
    public byte Pad { get; set; }

    /// <summary>
    /// 报文数据，有效长度位CanLenth
    /// </summary>
    public byte[]? Data { get; set; }

    /// <summary>
    /// <see cref="CanTransmitType"/>:发送方式，主要用于Zlg系列Can卡
    /// </summary>
    public CanTransmitType TransmitType { get; set; } = CanTransmitType.NormalSend;
}